/* SourceClassPattern.java
 * Author: liuex
 * 2007-12-16 ����05:26:09
 *
 * Note: 
 */
package org.lex.utils.logging.pattern;

import java.util.logging.LogRecord;

public class LevelPattern extends Pattern {
	private boolean localize = false;

	/**
	 * @param pattern
	 */
	public LevelPattern(String pattern) {
		super(pattern);
		if (this.getStyles().length > 0)
			this.localize = this.getStyles()[0].toLowerCase().equals("local");
	}

	@Override
	public String format(LogRecord record) {
		if (true == localize)
			return record.getLevel().getLocalizedName();
		else
			return record.getLevel().getName();
	}
}
